<%@ page language="java"  pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib  uri="/struts-tags" prefix="s" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>客户管理</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	 <LINK href="resource/css/admin.css" type="text/css" rel="stylesheet">
	<LINK href="resource/css/style.css" type="text/css" rel="stylesheet">
	 <script type="text/javascript" src="scripts/sorttable.js"></script> 
	 <script type="text/javascript" src="<%=basePath%>scripts/jquery-1.4.2.js"></script>
	 <script type="text/javascript">
	     var basePath="<%=basePath%>";
	     function selectAllChkboxs(flag)
	        {
	        var getChkboxs = document.getElementsByName("box");
	        for(var i=getChkboxs.length-1;i>=0;i--)
	        {
	          getChkboxs[i].checked=flag;
	        }
	       }
	       function   deletebox(){
             var flag=false;
             var  deleteString="";
           var  checks=document.getElementsByName("box");
           for(var i=0;i<checks.length;i++){
	           if(checks[i].checked){
	                 var  idvalue=checks[i].value;
	                 flag=true;
	               deleteString+=idvalue+"_";
	               
	           }
	       }
          if(!flag){
              alert('请选择要删除的记录');
          }else{ 
              var url1 = basePath+"custom/deletecustom.shtml";
             
           $.ajax({
                   url: url1,
                   data: "id="+deleteString,
                 success: function(msg){
                     
                     var obj=eval('('+msg+')');
                     var result=obj[0]["message"];
                     alert(result);
                     window.location.reload();
                    
                 }
                });
          }
      }
         function   editClick(id){
             window.location.href=basePath+"custom/getcustomById.shtml?id="+id;
      }
	 </script>
  </head>
  
  <body>
    <div style="height:150px;overflow-y:scroll;float:left; align:center;">
       
        <table class="dt1 sortable scrolltable "  border="0" cellpadding="1" cellspacing="1" align="center" width="100%" >
			<tr class="th1">
			
				<td class="w1">
					
				</td>
				<td class="w1 column_sortable">
					客户类别名称
				</td>
				<td class="w1 column_sortable">
					客户名称
				</td>
				<td class="w1 column_sortable">
					客户排列顺序
				</td>
				<td class="w2  column_sortable">
					简介
				</td>
				<td class="w6  column_sortable">
					操作栏
				</td>
				
			</tr>
			<s:iterator id="custom" value="list">
			  <tr>
			    <td><input type="checkbox" name="box" value="${custom.id}"/></td>
			  <td>${custom.typeString}</td>
			  <td>${custom.name}</td>
			    <td>${custom.orderNum}</td>
			      <td>${custom.content}</td>
			  <td> <a href="javascript:void(0)" onclick='editClick(${custom.id})'> 修改</a></td>
			  </tr>
			</s:iterator>
        </table>
       
      </div>
       <table>
		<tr>
				<td width="250">
					
					<input type="button" value="全选" name="ChkAll1" id="ChkAll1" onclick="selectAllChkboxs(true);" />
					<input type="button" value="清空" name="ChkAll2" id="ChkAll2" onclick="selectAllChkboxs(false);" />
					<input type="button" id="Alldelete"  value="删除服务器"  onclick="deletebox();"/>
				</td>
      </tr>
      </table>  
  </body>
</html>
